package com.sicheng.蓝桥.练习题.dp;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author zsc
 * @version 1.0
 * @date 2022/4/27 19:26
 */
public class 跳跃的小名dp_解答 {
    static int N = 1010;
    static int n, p, t;
    //通过j步走到第i个格子的最大权值
    static int[][] f = new int[N][N];
    static int[] arr = new int[N];

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        p = sc.nextInt();
        t = sc.nextInt();
        for (int i = 1; i <= n; ++i) arr[i] = sc.nextInt();
        for (int[] a : f) {
            Arrays.fill(a, -0x3f3f3f);
        }
        //初始化：通过第一步能走到的位置
        for (int i = 1; i <= p && i <= n + 1; ++i) f[i][1] = arr[i];
        //走到第i格
        for (int i = 1; i <= n + 1; ++i) {
            //通过j步
            for (int j = 2; j <= t; ++j) {
                //上一次走了k步到达第i格
                for (int k = 1; k <= p && k <= i; ++k) {
                    f[i][j] = Math.max(f[i - k][j - 1] + arr[i], f[i][j]);
                }
            }
        }
        System.out.println(f[n + 1][t]);
    }
}
